<template>
  <div>
    <!-- <h2>
      我是About的内容
    </h2> -->
    <div>
      <h2>About组件内容</h2>
      <div>
        <ul class="nav nav-tabs">
          <li>
            <a
              class="list-group-item active"
              href="./home-news.html"
            >News</a>
          </li>
          <li>
            <a
              class="list-group-item "
              href="./home-message.html"
            >Message</a>
          </li>
        </ul>
        <ul>
          <li>news001</li>
          <li>news002</li>
          <li>news003</li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {

    }
  },
  // mounted() {
  //   console.log('about组件挂载完毕了', this);
  // },
  // beforeDestroy() {
  //   console.log('about组件即将被销毁了')
  // }

  //通过路由规则，进入该组件时被调用
  beforeRouteEnter(to, from, next) {
    if (to.meta.isAuth) { //判断是否需要鉴权
      if (localStorage.getItem('school') === 'atguigu') {
        next()  //放行
      } else {
        alert('学校名不对，无权限查看')
      }
    } else {
      next()  //放行
    }
  },

  //通过路由规则，离开该组件时被调用
  beforeRouteLeave(to, from, next) {
    console.log('beforeRouteLeave', to, from);
    next()
  }
}
</script>

<style>
</style>